//
//  ListFooterLoadView.swift
//  weile
//
//  Created by LKM on 16/10/17.
//  Copyright © 2016年 LKM. All rights reserved.
//

import UIKit

class ListFooterLoadView: UIView {
    
    class func createView() ->ListFooterLoadView{
        let mListFooterLoadView = Bundle.main.loadNibNamed("ListFooterLoadView", owner: nil, options: nil)!.last as! ListFooterLoadView
        mListFooterLoadView.setHidden()
        return mListFooterLoadView
    }
    
    @IBOutlet weak var v_refresh_text: UILabel!
    @IBOutlet weak var v_refresh_progress: UIActivityIndicatorView!

    /*
    // Only override draw() if you perform custom drawing.
     @IBOutlet weak var v_refresh_text: UILabel!
     @IBOutlet weak var v_refresh_text: UILabel!
    // An empty implementation adversely affects performance during animation.
    override func draw(_ rect: CGRect) {
        // Drawing code
    }
    */
    
    public func setHidden() {
        self.isHidden=true;
    }
    
    //———————— 三个状态————过程————————
    public func setRefreing() {
        setHidden()
    }
    
    public func setAppending() {
        self.isHidden=false;//(VISIBLE);
        v_refresh_progress.startAnimating();
        v_refresh_progress.isHidden = false//(VISIBLE);
        v_refresh_text.setText(str: "加载数据...");//("努力加载中 ");// ＞.＜
    }
    
    /**
        加载完毕咯
     */
    public func setNone( hasNextPage:Bool) {
        if (hasNextPage){
            setNone(tips:"");
        }else{
            setNoDate();
        }
    }

    //———————— 三个状态————过程——end——————
    //数据加载完毕
    public func setNone( tips:String) {
        isHidden=false;//(VISIBLE);
        v_refresh_progress.stopAnimating();
        v_refresh_progress.isHidden=true;//setVisibility(GONE);
        v_refresh_text.setText(str:tips);// ("点击加载更多");
    }
    
    // 没有数据了
    private func setNoDate() {
        self.isHidden=false;//(VISIBLE);
        
        v_refresh_progress.stopAnimating();
        v_refresh_progress.isHidden=true//(GONE);
        v_refresh_text.setText(str:"— 被你刷光了 —");// 被你刷光了 ＞﹏＜
    }
}
